//
//  ChangingViewCell.m
//  quxiangtao
//
//  Created by HHuajiang on 2018/11/26.
//  Copyright © 2018 shanhaijin. All rights reserved.
//

#import "ChangingViewCell.h"
@interface ChangingViewCell ()

@property (nonatomic, strong) UILabel *titleLbel;
@property (nonatomic, strong) UILabel *addtitleLbel;
@property (nonatomic, strong) UILabel *statusLbel;
@property (nonatomic, strong) UILabel *biliLbel;
@property (nonatomic, strong) UILabel *changeLbel;
@property (nonatomic, strong) UILabel *timeLbel;
@property (nonatomic, strong) UILabel *changebutton;;

@end
@implementation ChangingViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        UIImageView *bgimage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"integralContentCellbg"]];
        [self.contentView addSubview:bgimage];
        [bgimage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.mas_equalTo(Margin);
            make.right.mas_equalTo(-Margin);
            make.bottom.mas_equalTo(0);
        }];
        
        UILabel *titlelabel = [[UILabel alloc] init];
        titlelabel.textColor = Color333333;
        titlelabel.font = Font(24);
        [bgimage addSubview:titlelabel];
        [titlelabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.mas_equalTo(Margin);
        }];
        
        
        UILabel *statusLabel = [[UILabel alloc] init];
        statusLabel.textColor = Color1f89ff;
        statusLabel.font = Font(24);
        [bgimage addSubview:statusLabel];
        [statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-Margin);
            make.top.mas_equalTo(Margin);
        }];
        
        UILabel *integralLabel = [[UILabel alloc] init];
        integralLabel.textColor = Color1f89ff;
        integralLabel.font = Font(24);
        [bgimage addSubview:integralLabel];
        [integralLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(statusLabel.mas_left).offset(-Margin);
            make.top.mas_equalTo(Margin);
        }];
        
        UILabel *duihuanLabel = [[UILabel alloc] init];
        duihuanLabel.textColor = Color999999;
        duihuanLabel.font = Font(20);
        [bgimage addSubview:duihuanLabel];
        [duihuanLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(Margin);
            make.bottom.mas_equalTo(-Margin);
        }];
        
        UILabel *xiugaiLabel = [[UILabel alloc] init];
        xiugaiLabel.textColor = Color1f89ff;
        xiugaiLabel.font = Font(20);
        xiugaiLabel.text = @"修改";
        [bgimage addSubview:xiugaiLabel];
        [xiugaiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(duihuanLabel.mas_right).offset(Margin);
            make.bottom.mas_equalTo(-Margin);
        }];
        
        UILabel *timeLabel = [[UILabel alloc] init];
        timeLabel.textColor = Color999999;
        timeLabel.font = Font(20);
        [bgimage addSubview:timeLabel];
        [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.bottom.mas_equalTo(-Margin);
        }];
        
        
        self.titleLbel = titlelabel;
        self.statusLbel = statusLabel;
        self.addtitleLbel = integralLabel;
        self.changeLbel = duihuanLabel;
        self.timeLbel = timeLabel;
        self.changebutton = xiugaiLabel;
        
        
    }
    return self;
}


- (void)setModel:(ChangingModel *)model {
    self.titleLbel.text = model.doc;
    self.statusLbel.text = [NSString stringWithFormat:@"（%@）",model.state];
    self.statusLbel.textColor = model.status == 1 ? Color1f89ff : Color999999;
    self.changebutton.hidden = model.status == 1 ? NO : YES;
    self.addtitleLbel.text = [NSString stringWithFormat:@"+%@",model.num];
    self.changeLbel.text = model.unitdoc;
    self.timeLbel.text = model.create_time;
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];    
}

@end
